package com.skywolf.chem.manager.controller;

import com.skywolf.chem.common.sysconfig.pojo.vo.PageVO;
import com.skywolf.chem.common.sysconfig.response.RespData;
import com.skywolf.chem.manager.entity.OpinionParam;
import com.skywolf.chem.usercenterapi.entity.SuggestInfo;
import com.skywolf.chem.usercenterapi.service.ISuggestInfoService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 反馈与建议
 * Created by pei_pei on 2020/6/29.
 */
@RestController
@RequestMapping("/manager/opinion")
public class OpinionManagerController {

    @Autowired
    ISuggestInfoService suggestInfoService;

    @ApiOperation(value = "用户反馈列表",notes = "用户反馈列表")
    @RequestMapping(value = "/getSuggest",method = {RequestMethod.POST},produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public RespData<SuggestInfo> getSuggest(@RequestBody @Validated OpinionParam queryParam) {
        PageVO<SuggestInfo> page = suggestInfoService.pageSuggestInfoList(queryParam);
        return RespData.success(page);
    }

    @ApiOperation(value = "处理用户反馈意见",notes = "处理用户反馈意见")
    @RequestMapping(value = "/updateSuggestInfo",method = {RequestMethod.POST},produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public RespData<String> updateSuggestInfo(@RequestBody @Validated SuggestInfo updateParam) {
        suggestInfoService.updateById(updateParam);
        return RespData.success("success");
    }
}
